import tensorflow as tf

sess = tf.Session()
def a():
    v = tf.Variable(initial_value=1, dtype=tf.float32)
    v_1 = v.assign_add(tf.constant(1.0))

    sess.run(tf.global_variables_initializer())
    print(sess.run([v, v_1]))
a()

def b():
    print('################### Rank 0')
    mammal = tf.Variable("Elephant", tf.string)
    ignition = tf.Variable(451, tf.int16)
    floating = tf.Variable(3.1415926, tf.float64)
    its_complicated = tf.Variable(12.3 - 4.85j, tf.complex64)

    print('#################### Rank 1')
    mystr = tf.Variable(["Hello"], tf.string)
    cool_numbers = tf.Variable([3.14, 2.718], tf.float32)
    first_primes = tf.Variable([2,3,5,7,11], tf.int32)
    its_very_complicated = tf.Variable([12.3 - 4.86j, 7.5- 6.23j], tf.complex64)

    print('################## Higher-rank')
    squarish_squares = tf.Variable([[4, 9], [16, 25]], tf.int32)
    rank_of_squares = tf.rank(squarish_squares)
    print('rank_of_squares', rank_of_squares)
    sess.run(tf.global_variables_initializer())
    print(sess.run(rank_of_squares))

    print('#################### reshape')
    rank_threee_tensor = tf.ones([3,4,5])
    matrix = tf.reshape(rank_of_squares, [6, 10])

#b()

def c():
    print('#################initializer variable')
    my_int_variable = tf.get_variable('my_int_variable', dtype=tf.int32, initializer=tf.constant([23, 42]))
    sess.run(tf.global_variables_initializer())
    print(sess.run(my_int_variable))

c()



